﻿package chapter_06_Homework;

import java.util.Scanner;

/*
 * 		验证用户名和密码(三次退出)。
 */
public class Work_12 {
	public static void main(String[] args) {
		int i;
		Scanner sc = new Scanner(System.in);
		for(i = 1;i<=3;i++){
			System.out.print("请输入用户名：");
			String rightUser = sc.next();
			System.out.print("请输入密码：");
			int rightPwd = sc.nextInt();
			if("Roychin".equals(rightUser)&&"20170411".equals(rightPwd)){
				System.out.println("尊敬的"+rightUser+",您好！欢迎使用！");
				continue;
			}else{
				System.out.println("对不起，账户信息有误！请重新输入！您还有"+(3-i)+"次机会");
			}
		}
		if(i==4){
			System.out.println("抱歉，您的错误次数已达上限，请稍后重试！");
		}
	}
}
